// About

function showSection(id) {
  var sections = document.getElementsByTagName("section");
  for (var i = 0; i < sections.length; i++) {
    if (sections[i].getAttribute("id") != id) {
      sections[i].style.display = "none";
    } else {
      sections[i].style.display = "block";
    }
  }
}


function prepareInternalNav() {
  var articles = document.getElementsByTagName("article");
  var navs = articles[0].getElementsByTagName("nav");
  var nav = navs[0];
  var links = nav.getElementsByTagName("a");

  for (var i = 0; i < links.length; i++) {
    var id = links[i].getAttribute("href").split("#")[1];
    document.getElementById(id).style.display = "none";
    links[i].destination = id;
    links[i].onclick = function() {
      showSection(this.destination);
      return false;
    }
  }
}


addLoadEvent(prepareInternalNav);
